<!--#include file="common/header.html"-->
<body>
<div class="container-fluid larry-wrapper">
    <div class="row">
        <div class="col-xs-12 col-sm-12 col-md-12">
            <!--头部搜索-->
            <section class="panel panel-padding">
                <form class="layui-form" action="/education/admin/version">
                    <div class="layui-form">
                        <div class="layui-inline">
                            <div class="layui-input-inline">
                                <input class="layui-input" name="_query.keyword" placeholder="关键字">
                            </div>
                        </div>
                        <div class="layui-inline">
                            <button lay-submit class="layui-btn" lay-filter="search" id="search">查找</button>
                        </div>
                    </div>
                </form>
            </section>

            <!--列表-->
            <section class="panel panel-padding">
                <div class="group-button">
                    <button class="layui-btn layui-btn-small modal-catch"
                            data-params='{"content":".add-subcat", "title":"添加","type":"1", "full":"true", "maxmin":"true"}'>
                        <i class="iconfont">&#xe649;</i> 添加
                    </button>
                    <button class="layui-btn layui-btn-small layui-btn-danger ajax-all" data-name="checkbox" data-params='{"url": "/education/admin/version/delete"}'>
                        <i class="iconfont">&#xe626;</i> 删除
                    </button>
                </div>
                <div id="list" class="layui-form"></div>

                <div class="text-right" id="page"></div>
            </section>
        </div>
    </div>
</div>
<div class="add-subcat">
    <form class="layui-form layui-form-pane" action="/education/admin/version/save" id="form1">
        <input type="hidden" name="a.id">
        <div class="layui-form-item">
            <label class="layui-form-label">版本号</label>
            <div class="layui-input-block">
                <input type="text" name="a.version" required jq-verify="required"  class="layui-input ">
            </div>
        </div>

        <div class="layui-form-item">
            <label class="layui-form-label">内部序号</label>
            <div class="layui-input-block">
                <input type="text" name="a.num" required jq-verify="required"  class="layui-input ">
            </div>
        </div>

        <div class="layui-form-item">
            <label class="layui-form-label">描述</label>
            <div class="layui-input-block">
                <input type="text" name="a.description" required jq-verify="required"  class="layui-input ">
            </div>
        </div>

        <div class="layui-form-item">
            <label class="layui-form-label">是否强制</label>
            <div class="layui-input-inline">
                <input type="radio" name="a.forced" title="是" value="1" checked />
                <input type="radio" name="a.forced" title="否" value="0" />
            </div>
        </div>

        <div class="layui-form-item">
            <label class="layui-form-label">下载地址</label>
            <div class="layui-input-block">
                <input type="text" name="a.url" required jq-verify="required" class="layui-input">
            </div>
        </div>

        <div class="layui-form-item">
            <div class="layui-input-block">
                <button class="layui-btn" jq-submit jq-filter="submit">立即提交</button>
                <button type="reset" class="layui-btn layui-btn-primary">重置</button>
            </div>
        </div>
    </form>
</div>

</body>
<script id="list-tpl" type="text/html"
        data-params='{"url":"/education/admin/version","dataName":"versionData","pageid":"#page", "method":"post"}'>
    <table id="example" class="layui-table lay-even" data-name="versionData" data-tplid="list-tpl">
        <thead>
        <tr>
            <th width="30"><input type="checkbox" id="checkall" data-name="checkbox" lay-filter="check"
                                  lay-skin="primary"></th>
            <th>版本号</th>
            <th>序号</th>
            <th>描述</th>
            <!--<th>强制更新</th>-->
            <th>下载地址</th>
            <th>更新时间</th>
            <th width="120">操作</th>
        </tr>
        </thead>
        <tbody>
        {{# layui.each(d.list, function(index, item){ }}
        <tr>
            <td><input type="checkbox" name="checkbox" value="{{ item.id}}" lay-skin="primary"></td>
            <td>{{ item.version }}</td>
            <td>{{ item.num }}</td>
            <td>{{ item.description }}</td>
            <!--<td>{{ item.forced }}</td>-->
            <td>{{ item.url }}</td>
            <td>{{ item.createtime||'' }}</td>
            <td>
                <!--<button class="layui-btn layui-btn-mini" onclick="_edit('{{item.id}}','{{item.version}}');">编辑</button>-->
                <button class="layui-btn layui-btn-mini layui-btn-danger ajax"
                        data-list='{"key":"id={{ item.id}}","msg":true,"render":"true","action":"del"}'
                        data-params='{"url": "/education/admin/version/delete/{{item.id}}","data":"", "method":"post", "confirm":"true"}'>
                    删除
                </button></td>
            </td>
        </tr>
        {{# }); }}
        </tbody>

    </table>
</script>
<script src="../js/layui/layui.js"></script>
<script type="text/javascript" src="../js/lib/jquery-1.11.2.min.js"></script>
<script type="text/javascript" src="../js/lib/rest.js"></script>
<script type="text/javascript" src="../../jsfile/jquery/jquery.form.js"></script>
<!--#include file="common/version.html"-->
<script type="text/javascript" src="js/area_select.js"></script>
<script>
    layui.use('user_list');

    function _edit(ids, name) {
        var index = layer.open({
            type: 1,
            title:'编辑【'+ name +'】',
            content: $('.add-subcat')
        });
        layer.full(index);
        $('.imgbox').children().remove();
        $('#form1').attr('action', '/education/admin/version/update/' + ids);
        restGet('/education/admin/version/view/' + ids, null, $('#form1'), function(rs){
        })
    }

</script>

</html>